import {
    createStore,
    combineReducers,
    applyMiddleware
} from 'redux';
import thunk from 'redux-thunk';

import {reducer as firstReducer} from '../views/First/_index.js';
import {reducer as twoReducer} from '../views/TwoRedux/_index.js';


import {reducer as ajaxReducer} from '../views/AjaxPage/_index.js';

import {reducer as downupReducer} from '../views/Downup/_index.js';

const reducer = combineReducers({
    first:firstReducer,
    two:twoReducer,
    ajaxPage:ajaxReducer,
    downup:downupReducer,
    // remove:removeReducer,
    // edit:editReducer,
})
// state.two
// store = {
//     first:[],
//     two:{}
// }

// 它是 Redux 的原生方法，作用是将所有中间件组成一个数组，依次执行

function newJson(str){
    var json = (new Function("return " + str))();
    return json;
}

// export default createStore(reducer,newJson(localStorage.getItem("ljmRout")),applyMiddleware(thunk));
export default createStore(reducer,
    newJson(localStorage.getItem("ljmRoot"))||{},
    applyMiddleware(thunk));







//
